summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authort895 <clombardo169@gmail.com>2023-11-10 04:27:40 +0100
committert895 <clombardo169@gmail.com>2023-11-10 04:27:40 +0100
commit09f993899e174d1f3c4577ab713eb8119741093e (patch)
tree0d16140c1cac52c3675f3e311fef8d851c53365f
parentMerge pull request #11977 from SamayXD/patch-1 (diff)
downloadyuzu-09f993899e174d1f3c4577ab713eb8119741093e.tar
yuzu-09f993899e174d1f3c4577ab713eb8119741093e.tar.gz
yuzu-09f993899e174d1f3c4577ab713eb8119741093e.tar.bz2
yuzu-09f993899e174d1f3c4577ab713eb8119741093e.tar.lz
yuzu-09f993899e174d1f3c4577ab713eb8119741093e.tar.xz
yuzu-09f993899e174d1f3c4577ab713eb8119741093e.tar.zst
yuzu-09f993899e174d1f3c4577ab713eb8119741093e.zip
-rw-r--r--src/android/app/src/main/jni/emu_window/emu_window.cpp8
-rw-r--r--src/android/app/src/main/jni/emu_window/emu_window.h4
-rw-r--r--src/android/app/src/main/jni/native.cpp2
-rw-r--r--src/android/app/src/main/jni/native.h3
4 files changed, 13 insertions, 4 deletions
diff --git a/src/android/app/src/main/jni/emu_window/emu_window.cpp b/src/android/app/src/main/jni/emu_window/emu_window.cpp
index a7e414b81..c4f631924 100644
--- a/src/android/app/src/main/jni/emu_window/emu_window.cpp
+++ b/src/android/app/src/main/jni/emu_window/emu_window.cpp
@@ -9,6 +9,7 @@
#include "input_common/drivers/virtual_gamepad.h"
#include "input_common/main.h"
#include "jni/emu_window/emu_window.h"
+#include "jni/native.h"
void EmuWindow_Android::OnSurfaceChanged(ANativeWindow* surface) {
m_window_width = ANativeWindow_getWidth(surface);
@@ -57,6 +58,13 @@ void EmuWindow_Android::OnRemoveNfcTag() {
m_input_subsystem->GetVirtualAmiibo()->CloseAmiibo();
}
+void EmuWindow_Android::OnFrameDisplayed() {
+ if (!m_first_frame) {
+ EmulationSession::GetInstance().OnEmulationStarted();
+ m_first_frame = true;
+ }
+}
+
EmuWindow_Android::EmuWindow_Android(InputCommon::InputSubsystem* input_subsystem,
ANativeWindow* surface,
std::shared_ptr<Common::DynamicLibrary> driver_library)
diff --git a/src/android/app/src/main/jni/emu_window/emu_window.h b/src/android/app/src/main/jni/emu_window/emu_window.h
index b38087f73..a34a0e479 100644
--- a/src/android/app/src/main/jni/emu_window/emu_window.h
+++ b/src/android/app/src/main/jni/emu_window/emu_window.h
@@ -45,7 +45,7 @@ public:
float gyro_z, float accel_x, float accel_y, float accel_z);
void OnReadNfcTag(std::span<u8> data);
void OnRemoveNfcTag();
- void OnFrameDisplayed() override {}
+ void OnFrameDisplayed() override;
std::unique_ptr<Core::Frontend::GraphicsContext> CreateSharedContext() const override {
return {std::make_unique<GraphicsContext_Android>(m_driver_library)};
@@ -61,4 +61,6 @@ private:
float m_window_height{};
std::shared_ptr<Common::DynamicLibrary> m_driver_library;
+
+ bool m_first_frame = false;
};
diff --git a/src/android/app/src/main/jni/native.cpp b/src/android/app/src/main/jni/native.cpp
index 1484cc224..64663b084 100644
--- a/src/android/app/src/main/jni/native.cpp
+++ b/src/android/app/src/main/jni/native.cpp
@@ -372,8 +372,6 @@ void EmulationSession::RunEmulation() {
m_system.InitializeDebugger();
}
- OnEmulationStarted();
-
while (true) {
{
[[maybe_unused]] std::unique_lock lock(m_mutex);
diff --git a/src/android/app/src/main/jni/native.h b/src/android/app/src/main/jni/native.h
index 6b02c44b5..78ef96802 100644
--- a/src/android/app/src/main/jni/native.h
+++ b/src/android/app/src/main/jni/native.h
@@ -52,9 +52,10 @@ public:
void OnGamepadDisconnectEvent([[maybe_unused]] int index);
SoftwareKeyboard::AndroidKeyboard* SoftwareKeyboard();
+ static void OnEmulationStarted();
+
private:
static void LoadDiskCacheProgress(VideoCore::LoadCallbackStage stage, int progress, int max);
- static void OnEmulationStarted();
static void OnEmulationStopped(Core::SystemResultStatus result);
private: